package com.dsj.gxrd.modules.controller.activity;

import com.dsj.gxrd.modules.activity.domain.query.RdScoreDetailQuery;
import com.dsj.gxrd.modules.activity.domain.vo.RdScoreCockpitRankVo;
import com.dsj.gxrd.modules.activity.domain.vo.RdScoreDetailInfoVo;
import com.dsj.gxrd.modules.activity.domain.vo.RdScoreDetailVo;
import com.dsj.gxrd.modules.activity.service.RdScoreDetailService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @author songpin566
 * @date 2023/09/14
 **/
@RestController
@Api("积分管理")
@RequestMapping("/score/detail")
public class RdScoreDetailController extends BaseController {

    @Autowired
    private RdScoreDetailService rdScoreDetailService;

    @GetMapping("/list")
    public TableDataInfo list(RdScoreDetailQuery scoreDetailQuery) {
        startPage();
        List<RdScoreDetailVo> list = rdScoreDetailService.selectScoreDetailList(scoreDetailQuery);
        return getDataTable(list);
    }

    @GetMapping("/{id}/{year}")
    public AjaxResult getInfo(@PathVariable("id") Long id,@PathVariable("year") Integer year) {
//        startPage();
        return rdScoreDetailService.getInfo(id,year);
    }

    @GetMapping("/rank")
    public TableDataInfo rank(@RequestParam("year") Integer year) {
        startPage();
        List<RdScoreCockpitRankVo> list = rdScoreDetailService.rank(year);
        return getDataTable(list);
    }


}
